﻿@model Models.DataModel.UserAccount
@{
    ViewBag.Title = "ChangePass";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h3>Change PassWord</h3>
<h4 style="margin-left:200px;color:red">@ViewBag.Error</h4>

@using (Html.BeginForm("ChangePass", "UserAccount", FormMethod.Post, new { @class = "form-horizontal", role = "form", name = "dataupload", id = "dataupload", onsubmit = "return CheckInput();" }))
{
    @Html.ValidationSummary();
    @Html.HiddenFor(c => c.UserAccountID)

    
    <div class="">
        <div class="col-xs-12 col-sm-6 col-md-2">@Html.Label("UserName")</div>
        <div class="col-xs-6 col-md-4">@Html.TextBoxFor(c => c.UserName, new { @readonly = true })</div><br />
    </div><br />
    <div class="">
        <div class="col-xs-12 col-sm-6 col-md-2">@Html.Label("Old Password")</div>
        <div class="col-xs-6 col-md-10">@Html.Password("OldPassword")<em class="error" id="oldpass" style="display:none;">Please input your old password</em></div><br />
    </div><br />
    <div class="">
        <div class="col-xs-12 col-sm-6 col-md-2">@Html.Label("New Password")</div>
        <div class="col-xs-6 col-md-10">@Html.PasswordFor(c => c.Password)<em class="error" id="newpass" style="display:none;">Please input your new password</em></div><br />
    </div><br />
        @*@<div class="">
        <div class="col-xs-12 col-sm-6 col-md-2">@Html.Label("Confirm Password")</div>
        <div class="col-xs-6 col-md-10">@Html.Password("ConfirmPassword")<em class="error" id="confirmpass" style="display:none;">Please input your new password</em></div><br />
    </div><br />*@
    <input type="submit" value="Save" id="BtnSave" class="btn btn-primary" style="margin-left:200px" />
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#Password").text = "";
    })
    $("#BtnSave").click(function () {
        var NewPass = $("#Password").val().trim();
        var ConfirmPass = $("#ConfirmPassword").val().trim();
        var OldPass = $("#OldPassword").val().trim();
        if (OldPass == "") {
            $("#oldpass").css("display", "block");
            return false;
        }
        if (NewPass == "") {
            $("#newpass").css("display", "block");
            return false;
        }
        if (ConfirmPass == "") {
            $("#confirmpass").css("display", "block");
            return false;
        }
        //if (ConfirmPassword != NewPass) {
        //    $("#confirmpass").css("display", "block");
        //    $("#confirmpass").text("Confirm Password does not match");
        //    return false;
        //}
    });
</script>